//
//  ProgressUI.swift
//  uiKit-demo
//
//  Created by 陈澎 on 2024/12/25.
//

import UIKit
class MyProgressUI:UIViewController {
    func render(_ self: AnyObject) {
        let progressView = UIProgressView(progressViewStyle: .default)
        progressView.frame = CGRect(x: 20, y: 1100, width: 280, height: 10)
        // 设置当前进度
        progressView.progress = 0.0
        // 设置已经走过的进度颜色
        progressView.progressTintColor = UIColor.green
        // 设置为走过的进度颜色
        progressView.trackTintColor = UIColor.red
        self.addSubview(progressView)
        Timer.scheduledTimer(withTimeInterval: 1, repeats: true){ Timer in
            if progressView.progress == 1 {
                progressView.progress = 0.0
                // 停止定时器
                Timer.invalidate()
                return
            }
            progressView.progress += 0.1
        }
    }
}
